# 6_5 屏幕使用：使用字体
# https://learn.adafruit.com/circuitpython-display-support-using-displayio
# https://learn.adafruit.com/circuitpython-display-support-using-displayio/ui-quickstart
# https://learn.adafruit.com/custom-fonts-for-pyportal-circuitpython-display

'''
5. 使用字体
'''
import board
import displayio
from adafruit_display_text import label
from adafruit_bitmap_font import bitmap_font

# 1. 屏幕基础配置
display = board.DISPLAY

# 5. 使用字体
font_file = "fonts/Helvetica-Bold-16.bdf"
font = bitmap_font.load_font(font_file)

# font_cn_file = "fonts/sanjiruosixingkai-19.bdf"
# font_cn = bitmap_font.load_font(font_cn_file)

text_group = displayio.Group(
    scale=1,
    x=0,
    y=0,
)

text = "Hello World!"
text_area = label.Label(font, text=text, color=0xFF0000, x=20, y=10)
text_group.append(text_area)  # Subgroup for text scaling

# text_cn = "白日依山尽\n黄河入海流\n欲穷千里目\n更上一层楼"
# text_cn_area = label.Label(font_cn, text=text_cn, color=0x00FF00, x=0, y=0)
# text_group.append(text_cn_area)  # Subgroup for text scaling

display.show(text_group)
